package cn.com.xky.jdbctemplate.service.impl;

import cn.com.xky.jdbctemplate.dao.IUserDao;
import cn.com.xky.jdbctemplate.domain.User;
import cn.com.xky.jdbctemplate.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by EKEYXIA on 2017/8/14.
 */
@Service
public class UserServiceImp implements IUserService{

    @Autowired
    private IUserDao userDao;


    @Override
    public void add(User user) {
        userDao.save(user);
    }

    @Override
    public void delete(Integer id) {
        userDao.delete(id);
    }

    @Override
    public void update(Integer id, User user) {
        userDao.update(id,user);
    }

    @Override
    public List<User> getUsers() {
        return userDao.getAll();
    }

    @Override
    public User getOne(Integer id) {
        return userDao.getOne(id);
    }
}
